package JasonsClasses;

public class Ship {
	private int length, x, y;
	private boolean orient;
	private boolean[] destroyed;
	private String image;
	/*Type indicates which kind of ship this is:
	 * 0:patrol boat -- size: 2
	 * 1:submarine -- size : 3
	 * 2:destroyer -- size : 3
	 * 3:battleship -- size : 4
	 * 4:aircraft carrier -- size : 5
	 */
	private int type;
	public Ship(int x, int y, boolean orient, int type){
		int i;
		this.type = type;
		if(type == 0){
			this.length = 2;
		}
		else if(type == 1 || type == 2){
			this.length = 3;
		}
		else if(type == 3){
			this.length = 4;
		}
		else{
			this.length = 5;
		}
		this.x = x;
		this.y = y;
		this.orient = orient;
		this.destroyed = new boolean[length];
		for(i=0;i<length;i++){
			this.destroyed[i] = false;
		}
	}
	
	public int getLength(){
		return this.length;
	}
	
	public int getX(){
		return this.x;
	}
	
	public int getY(){
		return this.y;
	}
	
	public boolean getOrient(){
		return this.orient;
	}
	
	public boolean isDestoyed(){
		int i;
		for(i=0;i<length;i++){
			if(destroyed[i] == false)
				return true;
		}
		return false;
	}
}
